package pers.zc.activiti.hivepool;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * @description 注入hive数据源
 * @Author Lin FuYuan
 * @date 2020/1/3
 */
@Repository
public class HiveJdbcBaseDaoImpl {
    private JdbcTemplate jdbcTemplate;
    public JdbcTemplate getJdbcTemplate(){
        return jdbcTemplate;
    }
    public JdbcTemplate getJdbcTemplate(String name,String password){
        setJdbcTemplate(name,password);
        return jdbcTemplate;
    }


    @Autowired
    HiveDuiredConfig hiveDuiredConfig;
//    @Autowired
//    public void setJdbcTemplate() {
//        this.jdbcTemplate = new JdbcTemplate(hiveDuiredConfig.dataSource());
//    }


    public void setJdbcTemplate(String name,String password) {
        System.out.println(name+";"+password);
        this.jdbcTemplate = new JdbcTemplate(hiveDuiredConfig.dataSource(name,password));
    }

}
